package models;


/**
 * @author Micha�
 *
 */
public class Card implements Comparable<Integer> {

	private int suit; 	//kolor
	private int figure;	//figura

	private int cardID; //unikalne ID karty
	private String fileName; //nazwa pliku z grafika karty

	//sta�e
	final static int F_JACK  = 11;
	final static int F_QUEEN = 12;
	final static int F_KING  = 13;
	final static int F_ACE   = 14;
	
	final static int S_DIAMONDS = 0; //karo
	final static int S_CLUBS 	= 1; //trefl
	final static int S_HEARTS 	= 2; //kier
	final static int S_SPADES 	= 3; //pik
	
//	public Card()
//	{ }
	
	public Card(final int s, final int f) throws PokerException
	{
		this.suit = s;
		this.figure = f;
		
		if(figure>14 || figure <2) throw new PokerException("Z�a figura karty!");
		if(suit <0 || suit >3) throw new PokerException("Z�y kolor karty!");
		
		// FIX THE ID GENERATOR OR CHANGE FILENAMES
		if(f != F_ACE)
			this.cardID = 100+suit*13+figure;
		else this.cardID = 100+suit*13+1;
		
		this.fileName = Integer.toString(cardID)+".png";
	}
	
	public int getCardID()
	{
		return this.cardID;
	}
	
	public int getSuit()
	{
		return this.suit;
	}
	
	public int getFigure()
	{
		return this.figure;
	}
	
	public String getCardFileName()		
	{		
		return this.fileName;		
	}
	
	public int compareTo(Integer c)
	{
		if(c == cardID) return 0;
		else
			return -1;
	}
}
